Revising the Select Query I hackerrank solution